 <extend name="common:commonTemplate" />

<block name="main_content">
<div id="main_div" class="order_menu" curr_index="1" order_type="{$type}">
    
    <a style="margin-left:0;width:24%;" id="order_type1" href="/order/orderlist/1">所有</a>
    
    <a style="margin-left:0;width:24%;" id="order_type2" href="/order/orderlist/2">未分成</a>
    
    <a style="margin-left:0;width:24%;" id="order_type3" href="/order/orderlist/3">已分成</a>
    
    <a style="margin-left:0;width:24%;" id="order_type4" href="/order/orderlist/4">未支付</a>
</div>
<div class="orderlist">
	<volist id="order_en" name="lst_order_en">
    <dl>
    
        <dt>订单编号：{$order_en.order_id}(<span style="color:red;">{$order_en.order_revenue_status_text}</span>)</dt>
        <dd>
            <div class="order_info">
            	<p class="order_time">下单时间：<span>{$order_en.order_date}</span></p>
                <p>订单金额：￥{$order_en.order_amount}</p>
                <p>推&nbsp;荐&nbsp;&nbsp;人：{$order_en.promoter_name}</p>
            </div>
            <a href="/order/orderDetail?order_id={$order_en.order_id}" class="order_view">
                <span class="order_txt">提成金额</span>
                <span style="color:#ff7800;font-size:1.2rem;">￥{$order_en.revenue_amount}</span>
            </a>
        </dd>
     
    </dl>
    </volist>
	<dl id="next_page">
	<dd style="padding:0" class="login_tips">
		<a href="javaScript:void(0);" id="btn_next_page" class="btn_lower2">下一页</a>
	</dd>
	</dl>
</div>
<div class="fixnav">
    <a href="/admin/home" class=""><img src="/Public/images/menu_01.png" alt=""/><span>首页</span></a>
    <a href="/order/orderlist" class="active focus"><img src="/Public/images/menu_actiive_02.png" alt=""/><span>所有订单</span></a>
    <a href="/promoter/center"><img src="/Public/images/menu_03.png" alt=""/><span>个人中心</span></a>
</div>
</block>
<block name="inner_script">
<script>
$(function(){
//  获取列表高度，多出滚动
  var maxH;
  var winH=window.innerHeight;
  var h1=(document.body.offsetWidth/320) *14*5
  maxH=winH-2*h1;

  $('.orderlist').css({
      'height':maxH
  })
});

$(document).ready(function(){
	
	//顶部标签卡样式
	var order_type = $('#main_div').attr('order_type');
	if(order_type == '1'){
		$('#order_type1').addClass('cur');
	}
	if(order_type == '2'){
		$('#order_type2').addClass('cur');
	}
	if(order_type == '3'){
		$('#order_type3').addClass('cur');
	}
	if(order_type == '4'){
		$('#order_type4').addClass('cur');
	}
	
	$('#btn_next_page').bind('click', function(){
		var promoter_id = $('#myaccount').attr('promoter_id');
		var type = $('#main_div').attr('order_type');
		var request_index = parseInt($('#main_div').attr('curr_index')) + 1;
		
		var result = OrderService.GetOrderList(promoter_id, type, request_index);
		if(result.IsSuccess == 0){
			alert(result.ErrorMsg);
			return;
		}
		else{
			$('#main_div').attr('curr_index', request_index);
			
			var html = '';
			var lst_order_en = result.Result; 
			
			if(lst_order_en.length > 0){
				for(var index in lst_order_en){
					var order_en = lst_order_en[index];
					html += '<dl>';
					html += '<dt>订单编号：' + order_en.order_id + '(<span style="color:red;">' + order_en.order_revenue_status_text + '<span></span>)</dt>';
					html += '<dd>';
					html += '<div class="order_info">';
					html += '<p class="order_time">下单时间：<span>' + order_en.order_date + '</span></p>';
					html += '<p>订单金额：￥' + order_en.order_amount + '</p>';
					html += '<p>推&nbsp;荐&nbsp;&nbsp;人：' + order_en.promoter_name + '</p>';
					html += '</div>';
					html += '<a href="/order/orderDetail?order_id=' + order_en.order_id + '" class="order_view">';
					html += '<span class="order_txt">提成金额</span>';
					html += '<span style="color:#ff7800;font-size:1.2rem;">' + order_en.revenue_amount + '</span>';
					html += '</a>';
					html += '</dd>';
					html += '</dl>';
				}
				
				$('#next_page').before(html);
			}
			else{
				$('#btn_next_page').text('没有数据了 ');
				$('#btn_next_page').unbind('click');
			}
			
		}
	});
});
</script>
</block>
 